package com.teaphy.coroutinecrawler.flow.operators.intermediate

import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*


fun main() = runBlocking {

    flowOf(1, 2, 3, 4)
        .scan(initial = 1) {
            accumulator, value ->
            println("accumulator: $accumulator, value: $value")
            accumulator * value
        }.collect {
            println("receive: $it")
        }
}
